<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en" class="no-js" id="ng-app">
<head>
<meta charset="UTF-8">
<jsp:include page="/includes/common/head.jsp" />
<link rel=stylesheet href="css/standard.css" type="text/css">
<title>CS4280 BOOKSTORE</title>
</head>
<body>
	<div data-flex-background-src="${ baseURL }/assets/img/background.jpg" flex-background></div>
	<jsp:include page="/includes/header.jsp">
   		<jsp:param name="currentUser" value="${currentUser}" /><jsp:param name="baseURL" value="${ baseURL }" />
	</jsp:include>
	<section id="mainContent">
		<div class="book_item_container">
			<jsp:include page="/includes/book_item.jsp?id=${book.id}&title=${book.title}&price=${book.price}&qty=${book.quantity}"/>
		</div>
		<form action="${ baseURL }/book?action=purchase" method="post">
			<input type="hidden" name="id" value="${book.id}">
			<input type="hidden" name="lp_earn" value="${lp_earn}">
			<c:if test="${book.quantity > 1}">
				<c:if test="${currentUser.role == 'ROLE_USER' || currentUser.role == 'ROLE_ADMIN'}">
					<p>
						Use <input type="text" name="lp_use" value="0"> LP
					</p>
					<p>You can earn ${lp_earn} LP from this item!</p>
				</c:if>
				<p>
					Quantity: <input type="text" name="qty" value="0">
				</p>
				<p>
					Recipient: <select name="name_prefix">
						<option value="Mr.">Mr.</option>
						<option value="Ms.">Ms.</option>
					</select> <input type="text" name="name">
				</p>
				<p>
					Address: <input type="text" name="address">
				</p>
				<p>
					Remarks: <input type="text" name="remarks">
				</p>
				<p>
					<input type="submit" name="purchase" value="PURCHASE">
				</p>
			</c:if>
		</form>
		<a href="${ baseURL }/home">BACK</a>
	</section>
</body>
</html>